package com.example.demo.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

@Data
@Getter
@Setter
@TableName("vacation")
public class Vacation {
    @TableId
    private int number;
    private int id;
    private String name;
    private int departmentid;
    private String department;
    private Date time;
    private String type;
    private String reason;
    private Date timeover;
    private String status;

    public void setTime(String time) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        try {
            this.time = sdf.parse(time);
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }

    public void setTimeover(String timeover) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        try {
            this.timeover = sdf.parse(timeover);
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
}